Fix fix for package-test gpg-agent cleanup race
authorRob Browning <rlb@defaultvalue.org>
Mon, 24 Oct 2016 17:42:09 +0000 (12:42 -0500)
committerRob Browning <rlb@defaultvalue.org>
Mon, 24 Oct 2016 17:42:14 +0000 (12:42 -0500)
Specify --no-autostart so that we don't start an agent if one wasn't
already running when we're requesting shutdown, and delete the test dir
with "rm -rf" to avoid being affected by vanishing sockets (sockets that
gpg-agent may be deleting in parallel).

1  2 
debian/.git-dpm
debian/patches/0007-Kill-gpg-agent-in-package-test.el-to-avoid-a-race.patch

diff --cc debian/.git-dpm
index 70bd5b44b0a85615de3759e0ab34368e6fe93203,0000000000000000000000000000000000000000..1fde73f442201c108abe03face2ff318d16fc64e
mode 100644,000000..100644
--- /dev/null
@@@ -1,8 -1,0 +1,8 @@@
- bc0af6a40c371ff8f4eaecad134c1831a6d49e75
- bc0af6a40c371ff8f4eaecad134c1831a6d49e75
 +# see git-dpm(1) from git-dpm package
++c7e8cdc2eee113bf6d49f25c1ef6d9ef02f8f94b
++c7e8cdc2eee113bf6d49f25c1ef6d9ef02f8f94b
 +d3e6b8a251634ad673242aaa4a298edbb2e8ee39
 +d3e6b8a251634ad673242aaa4a298edbb2e8ee39
 +emacs25_25.1+1.orig.tar.xz
 +e5357a302a9609e2efc2c942b03b9110245280bd
 +23167732
index a60d2fb98c9208154f93f8a3481c8a52caca5d20,0000000000000000000000000000000000000000..cd462253bf0b7096e64d5315076184c9ffd7e572
mode 100644,000000..100644
--- /dev/null
@@@ -1,34 -1,0 +1,41 @@@
- From bc0af6a40c371ff8f4eaecad134c1831a6d49e75 Mon Sep 17 00:00:00 2001
++From c7e8cdc2eee113bf6d49f25c1ef6d9ef02f8f94b Mon Sep 17 00:00:00 2001
 +From: Rob Browning <rlb@defaultvalue.org>
 +Date: Mon, 10 Oct 2016 17:35:56 -0500
 +Subject: Kill gpg agent in package-test.el to avoid a race
 +
 +package-test.el should no longer fail during clean up.
 +
 +* Previously a delete-directories call raced with the gpg agent's own
 +  cleanup process (presumably triggered by the first deletion of one of
-   the agent's sockets).  As a result, it looks like the agent could
++  the agent's sockets).  As a result, it looks like the agent might
 +  delete one of its sockets after delete-directories had decided to
 +  delete the socket, but before it made the attempt, causing an
 +  exception.
 +
 +* To fix the problem, explicitly ask gpg-connect-agent to kill the agent
-   before attempting to delete the gnupg home directory.
++  before attempting to delete the gnupg home directory, and then delete
++  via "rm -rf" to ignore any vanishing files.
 +---
-  test/automated/package-test.el | 3 +++
-  1 file changed, 3 insertions(+)
++ test/automated/package-test.el | 9 ++++++++-
++ 1 file changed, 8 insertions(+), 1 deletion(-)
 +
 +diff --git a/test/automated/package-test.el b/test/automated/package-test.el
- index c4c856f..7120112 100644
++index c4c856f..d071958 100644
 +--- a/test/automated/package-test.el
 ++++ b/test/automated/package-test.el
- @@ -149,6 +149,9 @@ package-test-fake-contents-file
++@@ -149,7 +149,14 @@ package-test-fake-contents-file
 +                ,@body)))
 + 
 +        (when (file-directory-p package-test-user-dir)
++-         (delete-directory package-test-user-dir t))
 ++         (call-process "gpg-connect-agent" nil nil nil
 ++                       "--homedir" (concat package-test-user-dir "/gnupg")
- +                       "killagent" "bye")
-           (delete-directory package-test-user-dir t))
+++                       "--no-autostart"
+++                       "killagent" "/bye")
+++         ;; Call "rm -rf" instead of delete-directory so that it won't
+++         ;; choke if the gpg-agent sockets disappear during the
+++         ;; recursive traversal.
+++         (call-process "rm" nil nil nil "-r" package-test-user-dir))
 + 
 +        (when (and (boundp 'package-test-archive-upload-base)
++                   (file-directory-p package-test-archive-upload-base))